
//细表datagrid
var dtlDatagrid;
$(function(){
	dtlDatagrid = $('#dtlDatagrid').datagrid({
		title : var_dtl_title,
		url: contextPath + '/tradecuscontractdtl/getTradeCusContractDtlListData.action?id='+var_tradeCusContract_id,
		singleSelect:true,
		width : 1020,
		height : 250,
		columns : [[
		     {title:var_column_serialnumber,field:'id',width:27,sortable:true,
		    	 sorter:function(a,b){
		    		 return (a>b?1:-1);
		    	 }
		     },
			{field : 'item',title : var_column_item,width : 94,editor : 'text'},
			{field : 'itemSize',title : var_column_itemSize,width : 100,editor : 'text'},
			{field : 'totalCont',title : var_column_totalCont,width : 75,editor : {type:'numberbox',options:{min:0,required:true,value:0}}},
			{field : 'boxOfCont',title : var_column_boxCont,width : 75,editor : {type:'numberbox',options:{min:0,required:true,value:0}}},
			{field : 'totalBoxs',title : var_column_totalBox,width : 75},
			{field : 'pcsOfBox',title : var_column_pcsBox,width : 75,editor : {type:'numberbox',options:{min:0,required:true,value:0}}},
			{field : 'totalPcs',title : var_column_totalPcs,width : 75},
			{field : 'mtwoOfCont',title : var_column_mtwoCont,width : 75},
			{field : 'totalMtwo',title : var_column_totalMtwo,width : 75},
			{field : 'fobUnitPrice',title : var_column_fobunitPrice,width : 75,editor : {type:'numberbox',options:{precision:2,min:0,required:true,value:0.00}}},
			{field : 'amount',title : var_column_amount,width : 75}
			] ],
		onBeforeEdit : function(index, row) {
			row.editing = true;
			updateActions(index);
			dtlDatagrid.datagrid('refreshRow', index);
			if(editcount<1){
				editcount++;
			}
		},
		onAfterEdit : function(index, row) {
			row.editing = false;
			updateActions(index);
			dtlDatagrid.datagrid('refreshRow', index);
			editcount--;
		},
		onCancelEdit : function(index, row) {
			row.editing = false;
			updateActions(index);
			dtlDatagrid.datagrid('refreshRow', index);
			editcount--;
		}
	});
		
	
	$('#totalTab').datagrid({
		width : 1020,
		columns : [[
			{field : 'name1',title : var_tatal_amount_str,width : 222},
			{field : 'name2',title : var_tradeCusContract_totTotalConts,width : 75},
			{field : 'name3',title : '--------',width : 75},
			{field : 'name4',title : var_tradeCusContract_totTotalBoxs,width : 75},
			{field : 'name5',title : '-----',width : 75},
			{field : 'name6',title : var_tradeCusContract_totTotalPcs,width : 75},
			{field : 'name7',title : '--------',width : 75},
			{field : 'name8',title : var_tradeCusContract_totTotalMtwos,width : 75},
			{field : 'name9',title : '',width : 75},
			{field : 'name10',title : var_tradeCusContract_totTotalAmount,width : 75},
			{field : 'name11',title : '',width : 90}
		]]
	});
	
	$('#amountEnTab').datagrid({
		width : 1020,
		columns : [[
			{field : 'name12',title : 'SAY TOTAL U.S. DOLLARS:<font color="red">'+var_tradeCusContract_totTotalAmountEn+"</font>",width : 1020}
		]]
	});
});
